Fix bug in last commit
authorJustin Burkett <justin@burkett.cc>
Wed, 30 Nov 2016 12:03:52 +0000 (07:03 -0500)
committerJustin Burkett <justin@burkett.cc>
Wed, 30 Nov 2016 12:03:52 +0000 (07:03 -0500)
The regexp-quote docstring is misleading since (regexp-quote "SPC x") will match
"SPC x c". Added back the beginning and end markers in the regexp.

which-key.el

index 7d99fa597a35992ab8c508dd3e06eac063cf0443..d383866b7d6ee5cd344ecd3b09891254d797b707 100644 (file)
@@ -810,7 +810,7 @@ replacements are added to
   (while key-sequence
     ;; normalize key sequences before adding
     (let ((key-seq (key-description (kbd key-sequence))))
-      (push (cons (cons (regexp-quote key-seq) nil)
+      (push (cons (cons (concat "\\`" (regexp-quote key-seq) "\\'") nil)
                   (cons nil (or (car-safe replacement) replacement)))
             which-key-replacement-alist)
       (when (consp replacement)
@@ -836,7 +836,7 @@ addition KEY-SEQUENCE REPLACEMENT pairs) to apply."
     (while key-sequence
     ;; normalize key sequences before adding
       (let ((key-seq (key-description (kbd key-sequence))))
-        (push (cons (cons (regexp-quote key-seq) nil)
+        (push (cons (cons (concat "\\`" (regexp-quote key-seq) "\\'") nil)
                     (cons nil (or (car-safe replacement) replacement)))
               mode-alist)
         (when (consp replacement)